<template>
  <div>
    <h2>canvas-table</h2>
    <CanvasTable
      :data="tableData"
      :columns="columns"
    />
  </div>
</template>
<script>
import CanvasTable from "./components/CanvasTable";

export default {
  components: { CanvasTable },
  data() {
    return {
      columns: [
        {
          key: "id",
          title: "编号",
          width: 50,
        },
        {
          key: "age",
          title: "年龄",
          width: 150,
        },
        {
          key: "gender",
          title: "性别",
          width: 150,
        },
      ],
      tableData: [], // 你的大数据源
    };
  },
  async created() {
    this.getData();
  },
  methods: {
    async getData() {
      const res = await this.$http.get("/user/list");
      console.log("res", res);
      this.tableData = res.data;
    },
    handleRowClick(row) {
      console.log("点击行:", row);
    },
  },
};
</script>
